#ifndef QTAPI_H
#define QTAPI_H

#include <QObject>
#include "Widget.h"

/**
 * @brief The QtApi class is called by Qt and JS
 */
class QtApi : public QObject
{
Q_OBJECT

public:
    QtApi(Widget *widget, QObject *parent = nullptr)
        : QObject(parent), m_widget(widget)
    {
        connect(widget, &Widget::sendText,
                this, &QtApi::sendText);
    }

signals:
    void sendText(const QString &text);

public slots:
    QString receiveText(const QString &text)
    {
        return m_widget->processReceivedText(text);
    }
private:
    Widget *m_widget;
};

#endif // QTAPI_H
